﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace PRO_DOCS.DocumentManagementSystem.CLIENT.WIN.Forms
{
    public partial class frmFileHistoryDetails : BLL.WIN.Templates.DevxPermissionTemplate
    {
        private DAL.Database.ARCHIVE_DEPARTMENT_FILE CURRENT_ARCHIVE_DEPARTMENT_FILE
        {
            set
            {
                this.Text = "Add a new revision to \"" + value.ARCHIVE_DEPARTMENT_FILE_DISPLAY_NAME + "\".";
                txtFileDisplayName.Text = value.ARCHIVE_DEPARTMENT_FILE_DISPLAY_NAME;
                txtVersionNumber.Text = (PRO_DOCSDatabaseDataContext.proc_ARCHIVE_DEPARTMENT_FILE_HISTORYLoadAllByARCHIVE_DEPARTMENT_FILE_ID(value.ARCHIVE_DEPARTMENT_FILE_ID).Count() + 1).ToString();
                txtCurrentUser.Text = BLL.WIN.Authentication.LOGGED_IN_EMPLOYEE_DETAILS.LOGIN_USER.EMPLOYEE_FULL_NAME;
                txtCurrentDate.Text = DateTime.Now.ToString();
            }
        }

        public string HISTORY_NOTES
        { get { return meHistoryNotes.Text; } }

        public frmFileHistoryDetails(DAL.Database.ARCHIVE_DEPARTMENT_FILE cURRENT_ARCHIVE_DEPARTMENT_FILE)
        {
            InitializeComponent();
            CURRENT_ARCHIVE_DEPARTMENT_FILE = cURRENT_ARCHIVE_DEPARTMENT_FILE;
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!meHistoryNotes.Text.Trim().Equals(string.Empty))
            {

                this.DialogResult = DialogResult.OK;
            }
            else
            {
                meHistoryNotes.BackColor = Color.LightGray;
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;

        }
    }
}